package com.buddy.design.pattern._03proxy.self;

import java.io.Serializable;


public class SProxy implements Serializable {

    private static final String ln = "\r\n";

    //生成代理对象的代码
    public static Object newProxyInstance(SClassLoader loader,
                                          Class<?>[] interfaces,
                                          SInvocationHandler h)
            throws IllegalArgumentException{
        //生成源代码
        String proxySrc = generateSrc(interfaces);
        //将生成的原代码保存到磁盘生成.java文件

        //编译源代码，并且生成.class文件

        //将class文件动态加载到JVM

        //返回被代理后的代理对象
        return null;
    }

    private static String generateSrc(Class<?>[] interfaces) {
        StringBuffer sb = new StringBuffer();
        sb.append("package com.buddy.design.pattern._03proxy.self;"+ln);
        sb.append("");
        return  "";
    }
}
